home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
BARNET
/
FREENET
/
JENKIN
/
023C
/
023c
/
SA
/
SAsource
(
.txt
)
< prev
Wrap
RISC OS BBC BASIC V Source
|
1998-09-20
|
20KB
|
923 lines
connect status :
0 = not connected
1 = trying
2 = *** reserved ***
+-2.5 waiting for confirmation of connect
3 = connected
+- 3.5 = download initiated
4 = downloaded
5 = ticking (on/off)
y% 8
y%!0=&4AF80:y%!4=&400C1
"Wimp_Initialise",310,&4B534154,"Ticker",y%
,task%
close:
$+" code "+
"Hourglass_Smash":
"OS_ReadMonotonicTime"
time%
saold=time%
"Wimp_ReadSysInfo",7
wimp
wimp>=350
wimp=
wimp=
connectstatus=1
mtresolv
FIRSTGO
open_resolver_window
dragging
inwindow
colourchange
connectstatus>=4
headlineget
init_sockets:connectstatus=1
connectstatus
,
(toggle
dragging)
firstone
3.5:
threepointfive
httpget
2.5:
connect
resolve
"OS_ReadMonotonicTime"
newtime%
(newtime%-time% > update*6000
sysvar("Ticker$Update"))
(toggle
sleep)
updateonoff
ticker_update
quit%
close
httpget
ptr%,flags%, request$, file$
headlineget
file$="headline"
file$="story2"
/8 request$="GET /tickerdata/"+file$+".dat HTTP/1.0"
0[
proxyonoff
request$="GET http://www.bbc.co.uk/tickerdata/"+file$+".dat HTTP/1.0"
"XSocket_Write",socket%!0,request$+
(request$)+4
ptr%;flags%
(ptr%=0
(flags%
1)=1)
!ptr% <> 36
3U connecterror=
:error$="Failed to connect to server":connectstatus=4:
connectstatus=3.5
at 0 in output file
("<ticker$dir>."+file$)
output=
output_pos=0
length=0
<" a=
("<ticker$dir>."+file$)
resolve
status,ptr%,flags%
host$="www.bbc.co.uk"
proxyonoff
host$=$(proxyhost%)
mtresolv
&66000,0,host$
,ptr%,flags%
ptr%=0
(flags%
1)=1
connecterror=
:error$="Resolving address failed":connectstatus=4:
G& ip%=!!(ptr%!16):connectstatus=2.5
&46001,host$
status,ptr%;flags%
(flags%
(status <> 36)
ptr%=0
(flags%
1)=1
connecterror=
:error$="Resolving address failed":connectstatus=4:b%!0=resolver%:
"Wimp_CloseWindow",,b%:
L/ b%!0=resolver%:
"Wimp_CloseWindow",,b%
M( ip%=!!(ptr%!16):connectstatus=2.5
connect
ptr%,flags%
host$="www.bbc.co.uk"
port=80
&FFFF
proxyonoff
host$=$(proxyhost%)
X$ port=
($(proxyport%))
&FFFF
right lets try to connect
[Jb%!0=2
((port
256)<<16)
((port
256)<<24):b%!4=ip%:b%!8=0:b%!12=0
"XSocket_Connect",socket%!0,b%,16
ptr%;flags%
(flags%
1)=1
!ptr%
_.
36:connectstatus=2.5:connecterror=
`.
37:connectstatus=2.5:connecterror=
a)
56:connectstatus=3:
beep
cB connecterror=
:error$=
string0(ptr%+4):connectstatus=4
dD
error$="Invalid argument"
error$="Connection failed"
addnewicon
jE
(clickerror
connecterror)
readfile
clickerror
connecterror
a$="
"+error$+". See help file for troubleshooting.":clickerror=
:clickable(i+1)=
l0
updateicon((i+1)
7,a$,0)
m, current=(current+1)
"OS_ReadMonotonicTime"
sa-saold>3
saold=sa
i=0
b%!0=main%:b%!4=i
w'
"Wimp_GetIconState",,b%
b%!16>132
y+ x=b%!8-speed:xx=b%!16-speed
x<132
x=132
{
xx<132
x=132
|>
SYS "Wimp_ResizeIcon",main%,i,x,-49,xx,-3
}+
"Wimp_DeleteIcon",,b%
~. b%!4=main%:b%!8=x:b%!16=xx
-
"Wimp_CreateIcon",,b%+4
>
i=current
xx<windowwidth
addnewicon
"Wimp_BlockCopy",main%,132+speed,-49,windowwidth+speed,-3,132,-49
threepointfive
mustget
=
"XSocket_Read",socket%!0,buffer%,2048
len;flags%
#
len
((flags%
1)=1)
stuff in buffer
d=0
a$=""
a$+=
buffer%?d
d+=1
>
buffer%?(d-1) = 10
buffer%?(d-1) = 13
d=len
+
a$,9)="BBCONLINE"
output=
a$,7)="REFRESH"
b=
a$=
a$,b-1)
2
$(headline%(8))<>
a$,b-9)
mustget=
, $(headline%(8))=
a$,b-9)
save_config
a$+=
)
a$,15)="Content-Length:"
b=
a$=
a$,b-1)
' length=
a$,b-16))
output
#a=output_pos
#a,a$;
output_pos=
4
length=output_pos
length
V
headlineget
length <1000
headlineget=
load_headlines
) connectstatus=4
:
"Socket_Shutdown",socket%!0,2
8
FIRSTGO
connectstatus+=1
,
toggle
toggle
d=len
mustget
headlineget=
firstone
get first icon data
connecterror
readfile
a$=" "
plot that first one
getmodeinfo
updateicon(0,a$,windowwidth-154)
connectstatus=5
FIRSTGO=
readfile
x1$, x2$
("<ticker$dir>.story2")
extent=
#y1=position
x1$=
x1=
x1=extent
position=0
position=x1
x1$,5)="STORY"
channel(
x1$,1)))
x1=extent
#y1=0
x1$=
x1>11
x1$="
x1$,x1-9)
x1=
x1=extent
position=0
position=x1
x2$=
x2$ <10
clickable((i+1)
clickable((i+1)
updateicon(number,text$,add)
before,bwidth
** calculate width of icon **
wimp
"Wimp_TextOp",1,text$,0
width
width=
text$*16
** where is the icon before?
before=(number+6)
b%!0=main%:b%!4=before
"Wimp_GetIconState",,b%
bwidth=b%!16
b%!0=main%:b%!4=number
"Wimp_GetIconState",,b%
"Wimp_DeleteIcon",,b%
7 b%!4=main%:b%!8=bwidth+add:b%!16=bwidth+width+add
"Wimp_CreateIcon",,b%+4
SYS "Wimp_ResizeIcon",main%,number,bwidth+add,-49,bwidth+width+add,-3
$(message%(number))=a$
)b%!0=main%:b%!4=number:b%!8=0:b%!12=0
"Wimp_SetIconState",,b%
close
"Wimp_CloseDown",task%,&4B534154
"unset ticker$running"
"unset ticker$Update"
"Wimp_Poll",,b%
windowopen
"Wimp_CloseWindow",,b%
b%!0=main%
inwindow=
makeblack(blue):blue=7
b%!0=main%
inwindow=
mouseclick
processkey(b%!0,b%!4,b%!24)
menuclick
17,18,19:
receive(r%,b%)
depressed
dragging=
userdrag
depressed
data
"Wimp_GetPointerInfo",,b%
data=b%!8
data/2 <>
(data/2)
data=
data=
=data
userdrag
b%!0=main%
"Wimp_GetWindowState",,b%
windowwidth=b%!12-b%!4
processkey(win,ico,key)
"Wimp_ProcessKey",key
windowopen
!b%=main%
modechanging
getmodeinfo
"Wimp_OpenWindow",,b%
receive(u,t%)
t%!16
0:quit%=
&400C1
modechanging=
&4AF80
u<>19
#.
now try and load prog to launch url
$>
"XOS_ReadVarVal","Alias$URLOpen_HTTP",b%,256
u = 0
clickerror=
'O error$="No Application has been seen that can launch this URL"
). $b%="URLOpen_HTTP "+launched$
*'
"Wimp_StartTask",b%
dragging=
headlineget=
toggle=
clickable(7)
inwindow=
blue=7
modechanging=
FIRSTGO=
output=
socket% &10
headline%(8)
buffer% 2048
connectstatus=0
clickerror=
connecterror=
position=0
current=0
b% 2048, menspc% 512, ws% 3072
message%(6)
channel(8)
wsend%=ws%+3072
quit%=
connected=
load_templates
load_config
ticker_menu
attach(tickermenu%,0,infobox%)
test_resolver
init_sockets
getmodeinfo
test_resolver
ptr%,flags%
"XOS_Module",18,"Resolver"
,,,ptr%;flags%
(flags%
mtresolv=
mtresolv=
getmodeinfo
height%
modechanging=
"OS_ReadModeVariable",-1,11
,,modewidth
"OS_ReadModeVariable",-1,12
,,modeheight
modewidth+=1:modeheight+=1
connectstatus
!b%=main%
^, b%!0=main%:
"Wimp_GetWindowState",,b%
_2 b%!4=leftwindow:b%!16=topwindow:b%!8=b%!16-52
b%!12=b%!4+windowwidth
b%!12>modewidth*2
b%!12=modewidth*2:windowwidth=b%!12-b%!4
toggle
b%!12=b%!4+132
autoadjust
windowwidth=modewidth*2
e-
windowwidth>3500
windowwidth=3500
f+
windowwidth<500
windowwidth=500
height=modeheight*2
iconbar
height=188
i< b%!4=0:b%!8=height-52:b%!12=windowwidth:b%!16=height
toggle
b%!12=132
"Wimp_OpenWindow",,b%
toggle
toggle
toggle=
toggle=
!b%=main%
w#
"Wimp_GetWindowState",,b%
toggle
b%!12=b%!4+132
b%!12=b%!4+windowwidth
"Wimp_OpenWindow",,b%
init_sockets
create a new socket for use, internet, stream
"Socket_Creat",2,1,0
socket%!0
!b%=-1
"Socket_Ioctl",socket%!0,&8004667E,b%
load_config
a, b, r$
("<ticker$dir>.choices")
r$=
speed=
(r$)*2
tempspeed=speed
$(speed%)=
(speed*2)
updateonoff=
sleep=
updateonoff
iconstate(config%,7,1)
sleep
iconstate(config%,32,1)
r$=
update=
tempupdate=update
- $(update%)="Every "+
(update)+" mins."
b=1
r$=
channel(b)=
1
channel(b)
iconstate(config%,b+11,1)
windowwidth=
windowwidth<500
windowwidth=500
windowwidth>3500
windowwidth=3500
$(proxyhost%)=
temphost$=$(proxyhost%)
$(proxyport%)=
tempport=
($(proxyport%))
r$=
proxyonoff=
proxyonoff
iconstate(config%,23,1)
$(headline%(8))=
autoadjust=
autoadjust
iconstate(config%,28,1)
iconbar=
leftwindow=
topwindow=
beep=
beep
iconstate(config%,30,1)
lowgraphics=
lowgraphics
iconstate(config%,29,1)
colour=
colour<0
colour>15
colour=15
load_headlines
load_headlines
a,b,r$
("<ticker$dir>.headline")
r$=
b=0
$(headline%(b))=
save_config
a, b, i
("<ticker$dir>.choices")
(tempspeed/2)
" b=
geticonstate(config%,7)
# b=
geticonstate(config%,32)
(b)
(tempupdate)
i=1
& b+=
geticonstate(config%,11+i)
i=1
4
channel(i)=
geticonstate(config%,11+i)
(channel(i))
(windowwidth)
#a,$(proxyhost%)
#a,$(proxyport%)
# b=
geticonstate(config%,23)
#a,$(headline%(8))
# b=
geticonstate(config%,28)
(iconbar)
!b%=main%
"Wimp_GetWindowState",,b%
(b%!4)
(b%!16)
" b=
geticonstate(config%,30)
" b=
geticonstate(config%,29)
colour
load_config
load_templates
"Wimp_OpenTemplate",,"<ticker$Dir>.Templates"
"Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"main", 0
,,ws%
message%(0)=b%!(108+(32*0))
message%(1)=b%!(108+(32*1))
message%(2)=b%!(108+(32*2))
message%(3)=b%!(108+(32*3))
message%(4)=b%!(108+(32*4))
message%(5)=b%!(108+(32*5))
message%(6)=b%!(108+(32*6))
"Wimp_CreateWindow",,b%
main%
"Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"Info", 0
,,ws%
"Wimp_CreateWindow",,b%
infobox%
"Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"config", 0
,,ws%
speed%=b%!(108+(32*21))
update%=b%!(108+(32*6))
i=0
#headline%(i)=b%!(108+32*(i+12))
proxyhost%=b%!(108+(32*24))
proxyport%=b%!(108+(32*25))
"Wimp_CreateWindow",,b%
config%
"Wimp_LoadTemplate",,b%,ws%,wsend%,-1,"message", 0
,,ws%
"Wimp_CreateWindow",,b%
resolver%
"Wimp_CloseTemplate"
** resize icons **
i=0
SYS "Wimp_ResizeIcon",main%,i,132,-49,132,-3
>
SYS "Wimp_ResizeIcon",main%,i,x,-49,xx,-3
+ b%!0=main%:b%!4=i
'
"Wimp_GetIconState",,b%
+
"Wimp_DeleteIcon",,b%
1 b%!4=main%:b%!8=132:b%!16=132
-
"Wimp_CreateIcon",,b%+4
colourchange
icon
"Wimp_GetPointerInfo",,b%
icon=b%!16
icon>-1
icon <8
icon<>7
icon<>blue
clickable(icon)
makeblue(icon)
blue<>7
clickable(blue)
makeblack(blue)
blue=icon
makeblue(i)
b%!0=main%:b%!4=i
)
"Wimp_GetIconState",,b%
# b%!8=colour*&1000000
b%!12=&F000000
)
"Wimp_SetIconState",,b%
makeblack(i)
i<0
i>6
b%!0=main%:b%!4=i
&)
"Wimp_GetIconState",,b%
b%!8=&7000000
b%!12=&F000000
))
"Wimp_SetIconState",,b%
mouseclick
b%!12
main%:
b%!8
0.
showmenu(tickermenu%,!b%-64,b%!4)
4:i=b%!16:
2Z
7:b%!0=main%:b%!4=1:b%!8=10:b%!12=10:b%!16=50:b%!20=50:
"Wimp_DragBox",,b%
i<>7
5+ a$=
geticontext(main%,b%!16)
load_url(a$)
1:i=b%!16:
toggle
;
i<>7
dragging=
<S b%!0=main%:b%!4=2:b%!8=0:b%!12=0:b%!16=0:b%!20=0:
"Wimp_DragBox",,b%
config%:
b%!16
@5
3:b%!0=config%:
"Wimp_CloseWindow",,b%
AB
save_config:b%!0=config%:
"Wimp_CloseWindow",,b%
tempspeed>2
tempspeed-=2:$(speed%)=
(tempspeed/2):b%!0=config%:b%!4=21:b%!8=0:b%!12=0:
"Wimp_SetIconState",,b%
tempspeed<20
tempspeed+=2:$(speed%)=
(tempspeed/2):b%!0=config%:b%!4=21:b%!8=0:b%!12=0:
"Wimp_SetIconState",,b%
tempupdate >1
tempupdate-=1:$(update%)="Every "+
(tempupdate)+" mins.":b%!0=config%:b%!4=6:b%!8=0:b%!12=0:
"Wimp_SetIconState",,b%
tempupdate <60
tempupdate+=1:$(update%)="Every "+
(tempupdate)+" mins.":b%!0=config%:b%!4=6:b%!8=0:b%!12=0:
"Wimp_SetIconState",,b%
proxy_shade
update_shade
H3
27:
"Filer_OpenDir <ticker$dir>.help"
proxy_shade
geticonstate(config%,23)
i=24
iconshade(config%,i,
update_shade
geticonstate(config%,7)
iconshade(config%,6,
iconshade(config%,10,
iconshade(config%,11,
iconshade(config%,32,
load_url(a$)
a$,x2-5)
("<ticker$dir>.story2")
#y2=0
x2$=
x2$,8)="HEADLINE"
x2=
x2$=
x2$,x2-9)
x2=t2
x2$=a$
x2$=a$
x2$=
t2=
x2$=
x2$,t2-4)
x2$<>""
launch_url(x2$,1)
ticker_update
sysvar("Ticker$Update","0")
Shit! Time to update the ticker
we ARE NOT connected, honest
"OS_ReadMonotonicTime"
time%
connectstatus=0
position=0
init_sockets
connectstatus=1
mtresolv
open_resolver_window
open_resolver_window
b%!0=resolver%
"Wimp_GetWindowState",,b%
%b%!4=modewidth-196:b%!12=b%!4+392
%b%!8=modeheight-96:b%!16=b%!8+192
"Wimp_OpenWindow",,b%
launch_url(a$,do)
hi%, len%, temp$
!b%!0=256:b%!12=0:b%!16=&4AF80
lowgraphics
hi%=
a$,"/hi/"):len%=
temp$=
a$,len%-(len%-hi%)-1)
temp$+="/low/"
temp$+=
a$,len%-hi%-3)
a$=temp$
$(b%+20)=a$+
"Wimp_SendMessage",18,b%,0,0
launched$=a$
menuclick
c%=b%+900
"Wimp_GetPointerInfo",,c%
adj%=(c%!8
"Wimp_DecodeMenu",,topmenu%,b%,c%
$c%
"Quit":quit%=
"Update Now":
ticker_update
"The BBC":
launch_url("http://www.bbc.co.uk/",0)
"News Online":
launch_url("http://news.bbc.co.uk",0)
"Updates...":
launch_url("http://www.geocities.com/Paris/Lights/7724",0)
"Choices":
update_choices
adj%
showmenu(topmenu%,topx%,topy%)
update_choices
c%=1
iconstate(config%,c%+11,-channel(c%))
$(speed%)=
(speed/2)
*$(update%)="Every "+
(update)+" mins."
$(proxyport%)=
(tempport)
$(proxyhost%)=temphost$
iconstate(config%,23,proxyonoff)
iconstate(config%,28,autoadjust)
iconstate(config%,30,beep)
iconstate(config%,29,lowgraphics)
proxy_shade
update_shade
E!b%=config%:
"Wimp_GetWindowState",,b%:
"Wimp_OpenWindow",,b%
---- menu stuff ----
make_menu
start%=menspc%
title$
$(start%)=title$
start%?12=7
start%?13=2
start%?14=7
start%?15=0
start%!20=44
start%!24=0
width%=
(title$)-3
menspc%+=28
item$
item$<>"*"
!menspc%=0
writeable%=
item$,"_")
ul%
tail$=
item$,
(item$)-ul%)
tail$,"T") !menspc%=!menspc%
tail$,"D") !menspc%=!menspc%
tail$,"W") !menspc%=!menspc%
4:writeable%=
buffer%:
buflen%
tail$,"M") !menspc%=!menspc%
item$=
item$,ul%-1)
item$>width% width%=
item$
menspc%!4=-1
writeable%
Zmenspc%!8=&0700F121:menspc%!12=buffer%:menspc%!16=-1:menspc%!20=buflen%:$buffer%=item$
item$<12
+menspc%!8=&07000021:$(menspc%+12)=item$
Imenspc%!8=&0700F121:menspc%!12=ws%:mwnspc%!16=-1:menspc%!20=
item$+1
$ws%=item$:ws%+=
item$+1
menspc%+=24
item$="*"
start%!16=width%*16+32
%!(menspc%-24)=!(menspc%-24)
mptr%=menspc%
=start%
attach(menu%,item%,sub%)
!(menu%+28+item%*24+4)=sub%
showmenu(menu%,x%,y%)
$topmenu%=menu%:topx%=x%:topy%=y%
"Wimp_CreateMenu",,menu%,x%,y%
ticker_menu
Ticker,Info,Choices,Update Now,Quit_D,The BBC,News Online,Updates...,*
tickermenu%=
make_menu
geticonstate(win%,icon%)
2!b%=win%:b%!4=icon%:
"Wimp_GetIconState",,b%
=(b%!24>>21
1)>0
iconstate(win%,icon%,type%)
s%,t%
type%
0:s%=0<<21:t%=1<<21
-1,1:s%=1<<21:t%=1<<21
2:s%=1<<21:t%=0<<21
)b%!0=win%:b%!4=icon%:b%!8=s%:b%!12=t%
"Wimp_SetIconState",,b%
iconshade(win%,icon%,type%)
s%,t%
type%
0:s%=0<<22:t%=1<<22
-1,1:s%=1<<22:t%=1<<22
2:s%=1<<22:t%=0<<22
)b%!0=win%:b%!4=icon%:b%!8=s%:b%!12=t%
"Wimp_SetIconState",,b%
geticontext(win%,icon%)
3b%!0=win%:b%!4=icon%:
"Wimp_GetIconState",,b%
((b%!24)
&100)=0
string0(b%+28)
string0(b%!28)
string0(a%):
a%=0
?a%>31
(a$)<255:a$=a$+
?a%:a%=a%+1:
sysvar(var$,val$)
"OS_SetVarVal",var$,val$,
val$,0,0
sysvar(var$)
len%,val$,F%
"XOS_ReadVarVal",var$,b%,256,0,0
,,len%;F%
len%=0
b%?len%=13